package com.didispace.web;

import java.util.LinkedHashMap;
import java.util.Map;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 *
 * @author 程序猿DD
 * @version 1.0.0
 * @blog http://blog.didispace.com
 *
 */
@Controller
public class HelloController {

    @RequestMapping("/")
    public String index() {
        return "index";
    }

   @RequestMapping("/hello")
    public String hello() {
        return "hello";
    }

    @RequestMapping(value = "/login", method = RequestMethod.GET)
    public String login() {
        return "login";
    }

    //////////////////security 资源访问开始
    /**
     * 需要权限的action
     */
    @RequestMapping({ "/test" })
    @ResponseBody
    public Map<String, String> test() {
        Map<String, String> map = new LinkedHashMap<String, String>();
        map.put("nametest", "12222");
        return map;
    }

    /**
     * 需要权限并且提供token才能访问的action
     */
    @RequestMapping({ "/se" })
    @ResponseBody
    public Map<String, String> se() {
        Map<String, String> map = new LinkedHashMap<String, String>();
        map.put("se", "3333");
        return map;
    }

   //////////////////security 资源访问资源结束

}